package common

type Stack []int

func (s *Stack) Push(n int) {
	*s = append(*s, n)
}

func (s *Stack) Len() int {
	return len(*s)
}
func (s *Stack) Peek() int {
	return s.Len()-1
}

func (s *Stack) Clear() {
	*s = (*s)[:0]
}

func (s *Stack) Pop() int {
	if s.Len() == 0 {
		return -1
	}
	n := (*s)[s.Len()-1]
	*s = (*s)[:s.Len()-1]
	return n
}
